package com.har.modules.business.controller;


import com.har.modules.ueditor.ActionEnter;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;

/**
 * @author macwy
 * @Title:har-mobile-medical-payments-admin
 * @Package com.har.controller
 * @Description  富文本编辑器
 * @date 2018/5/29 13:52
 * @Version 1.0
 */

@Controller

public class ActionController {

    @Value("${ueditor.config.filePath}")
    private String configPath;


    @RequestMapping("editor")
    @ResponseBody
    public  String action(HttpServletRequest request, HttpServletResponse response) throws JSONException, UnsupportedEncodingException {

        System.out.println(request.getContextPath());

        System.out.println(request.getRequestURI());

        request.setCharacterEncoding( "utf-8" );
        response.setHeader("Content-Type" , "text/html");
        return  new ActionEnter(request,"classpath:",configPath).exec();


    }

}
